package com.echo.code.spring.springbootdemo.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description
 *
 * @author baiyp
 * @version 1.0.0
 * @date 2019/04/28
 */
@RestController
@RequestMapping(value = "/user")
@Slf4j
public class UserController {

  @Autowired
  private WebConfig config;

  @RequestMapping(value = "/get/{userId}")
  public User getUserById(@PathVariable(value = "userId") int userId) {
    log.info("this server ip is {} and port is {}", config.getIp(), config.getPort());
    User user = User.builder().userName("Echo").userAge(20).userSalary(2000.00).build();
    return user;
  }
}
